<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root"></div>
    <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <script type="text/babel">
        class InputElement extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <div>
                    <label>{this.props.children}</label>    
                    <input  type={this.props.type} onBlur={this.props.validate} />
                    <span>{this.props.info}</span>
                </div>
            }
        }
        class RadioElement extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <div>
                    <label>{this.props.children}</label>    
                    <input type="radio" name={this.props.name} value="男" /><label>男</label>
                    <input type="radio" name={this.props.name} value="女" /><label>女</label>
                </div>
            }
        }
        class Add extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <div>
                        <h2>增加</h2>
                        <InputElement >姓名：</InputElement>
                        <InputElement>年龄：</InputElement>
                        <RadioElement name="addGender">性别：</RadioElement>
                        <input type="button" value="增加" />
                    </div>
            }
        }
        class Update extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <div>
                        <h2>修改</h2>
                        <InputElement>姓名：</InputElement>
                        <InputElement>年龄：</InputElement>
                        <RadioElement name="updateGender">性别：</RadioElement>
                        <input type="button" value="修改" />
                    </div>
            }
        }
        class Search extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <div>
                    <select>
                        <option value="name">姓名</option>
                        <option value="gender">性别</option>
                        <option value="age">年龄</option>
                    </select>   
                    <input type="text" placeholder="请输入搜索值" /> 
                    <input type="button" value="搜索" />
                </div>
            }
        }
        class List extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <table border="1">
                    <tr>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>年龄</th>
                        <th>操作</th>
                    </tr>
                    <tbody>
                        <tr>
                            <td>张飞</td>   
                            <td>男</td> 
                            <td>40</td> 
                            <td>
                                <input type="button" value="修改" />
                                <input type="button" value="删除" />
                            </td> 
                        </tr>    
                    </tbody>
                </table>
            }
        }
        class Student extends React.Component{
            constructor(props){
                super(props);
            }
            render(){
                return <div>
                    <h1>学生管理</h1>
                    <Add />
                    <Update />
                    <Search />
                    <List />
                    {/*

                    */}
                </div>
            }
        }
        
        ReactDOM.createRoot(document.getElementById("root")).render(<Student />);
    
    </script>
</body>
</html>